package collection;

import java.util.*;

public class GenericDemo {
    public static void main(String[] args) {
        /*Collection<String> c = new ArrayList<>();
        c.add("one");
        c.add("two");
        c.add("three");
        c.add("four");
        c.add("five");
        Iterator<String> it = c.iterator();
        for (String str : c){
            System.out.println(str);
        }*/
        /*若参数数组元素个数==集合元素个数，正常转
          若参数数组元素个数<集合元素个数，正常转
          若参数数组元素个数>集合元素个数，正常转(在末尾补默认值)
                */
        /*String[] array = c.toArray(new String[5]);
        System.out.println(Arrays.toString(array));*/
        String[] array = {"one","two","three","four","five"};
        List<String> list = Arrays.asList(array);
        System.out.println(list);
    }
}
